<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"              "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="unittest.js"></script> 
</head>
<body>
  <div>
	<script>
		function xhttp(url, callback)
		{
			if (typeof XMLHttpRequest != 'undefined') {
				httpRequest = new XMLHttpRequest();
			}
			else if (typeof ActiveXObject != 'undefined') {
				httpRequest = new ActiveXObject('Microsoft.XMLHTTP');
			}
			httpRequest.open('GET', url, true);
			httpRequest.onreadystatechange = function () {
				if (httpRequest.readyState == 4) {
					callback(httpRequest.responseText);
				}
			};
			httpRequest.send(null);			
		}	
		window.onload = function(){
			var test1 = new testcase("my firest test", {
				setup: function(){this.val = "abc";},
				teardown: function(){this.val = null;alert("test completed.");},
				test_get_name: function(){
					this.assert_equal("abb", this.val, "test get name");
					this.assert_not_equal("abb", this.val);
				},
				test_get_name1: function(){
					this.assert(false);
					throw "this is an exception";
				},
				async_test_google: function()
				{
					var self = this;					
					xhttp("http://www.google.com", function(html){
						self.assert(html.indexOf("google") > 0);
						self.complete();
					});					
				},
				async_test_yahoo: function()
				{
					var self = this;					
					xhttp("http://www.yahoo.com", function(html){
						self.assert(html, "google");
						self.assert(html.indexOf("yahoo") > 0);
						self.complete();
					});					
				}			
			});
			
			var test2 = new testcase("my second test", {
				test_name: function()
				{
					this.assert(false);
				}
			});				
			test1.run();
			test2.run();
		};
	</script>
	
  </div>
 
</body>
</html>